#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
const int N = 1e5 + 10;
int h[N];
int main()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> h[i];
    if (h[n] > h[1]) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}